package com.runmi.webchat.aftersale.common.result;

import java.util.List;

import com.runmi.webchat.aftersale.common.page.PageModel;

public class ResultFactory {

	public static Result getResultSuccess(){
		Result result=new Result();
		result.setReturnCode(ReulstContants.RETURN_CODE_SUCCESS);
		result.setReturnMessage(ReulstContants.RETURN_CODE_SUCCESS_MESSAGE);
		return result;
	}

	public static Result getResultSuccess(Object data){
		Result result=new Result();
		result.setData(data);
		result.setReturnCode(ReulstContants.RETURN_CODE_SUCCESS);
		result.setReturnMessage(ReulstContants.RETURN_CODE_SUCCESS_MESSAGE);
		return result;
	}
	
	public static Result getResultListSuccess(Object items){
		Result result=new Result();
		result.setItems(items);
		result.setReturnCode(ReulstContants.RETURN_CODE_SUCCESS);
		result.setReturnMessage(ReulstContants.RETURN_CODE_SUCCESS_MESSAGE);
		return result;
	}
	public static Result getResultListSuccess(Object items,PageModel page){
		ResultPage result=new ResultPage();
		result.setItems(items);
		result.setTotalCount(page.getTotalCount());
		result.setCpage(page.getCpage());
		result.setPageSize(page.getPageSize());
		result.setReturnCode(ReulstContants.RETURN_CODE_SUCCESS);
		result.setReturnMessage(ReulstContants.RETURN_CODE_SUCCESS_MESSAGE);
		return result;
	}
	public static Result getResultSuccess(Object data,Object items,PageModel page){
		ResultPage result=new ResultPage();
		result.setData(data);
		result.setItems(items);
		result.setTotalCount(page.getTotalCount());
		result.setCpage(page.getCpage());
		result.setPageSize(page.getPageSize());
		result.setReturnCode(ReulstContants.RETURN_CODE_SUCCESS);
		result.setReturnMessage(ReulstContants.RETURN_CODE_SUCCESS_MESSAGE);
		return result;
	}



	public static Result getResultFail(){
		Result result=new Result();
		result.setReturnCode(ReulstContants.RETURN_CODE_FAIL);
		result.setReturnMessage(ReulstContants.RETURN_CODE_FAIL_EXCEPTION);
		return result;
	}
	
	public static Result getResultFail(String returnCode,String message){
		Result result=new Result();
		result.setReturnCode(returnCode);
		result.setReturnMessage(message);
		return result;
	}

	public static Result getResultFail(String message){
		Result result=new Result();
		result.setReturnCode(ReulstContants.RETURN_CODE_FAIL);
		result.setReturnMessage(message);
		return result;
	}
	public static Result getResultFail(Object data){
		Result result=new Result();
		result.setData(data);
		result.setReturnCode(ReulstContants.RETURN_CODE_FAIL);
		result.setReturnMessage(ReulstContants.RETURN_CODE_FAIL_EXCEPTION);
		return result;
	}
	public static Result getResultFail(String message,Object data){
		Result result=new Result();
		result.setData(data);
		result.setReturnCode(ReulstContants.RETURN_CODE_FAIL);
		result.setReturnMessage(message);
		return result;
	}
	/**
	 * 系统未登陆
	 * @return
	 */
	public static Result getResultFailNotLogin(){
		Result result=new Result();
		result.setReturnCode(ReulstContants.RETURN_CODE_NOTLOGIN);
		return result;
	}
}
